<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // var(variable), let, const

        // 1. 先声明，后赋值
        var name;
        name = 'zhangsan';
        console.log(name);

        // 2. 声明的时候赋值
        var gender = 'female';
        console.log(gender);

        // 3. 不声明，直接赋值
        age = 9999;
        console.log(age);
    </script>
    <script>
        var arr = new Array(3);
        console.log(arr.length); // 3
        arr[1] = 'HTML5'; // 赋值
        arr[3] = 'BootStrap'; // C不可以；JavaScript可以
        console.log(arr.length); // 4
    </script>
</body>

</html>